<template>
	<view class="message">
		<view class="message-header">消息</view>
		<view class="message-list">
			<view class="message-item" v-for="item in messageList" :key="item.uid">
				<view class="right">
					<image :src="item.userHeader" mode=""></image>
					<view>
						<text>{{item.username}}</text>
						<text>{{item.message}}</text>
					</view>
				</view>
				<view class="message-time">{{item.sendTime}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				messageList:[]
			};
		},
		onLoad() {
			this.getMessageList()
		},
		methods:{
			getMessageList(){
				const messageList = require("../../utils/message.json");
				console.log(messageList)
				this.messageList = messageList.list
			}
		}
	}
</script>

<style lang="scss">
	.message {
		width: 710rpx;
		margin: 0 auto;

		.message-header {
			margin-top: 90rpx;
			margin-bottom: 25rpx;
			font-size: 42rpx;
			color: #000;
			font-weight: bold;
			box-sizing: border-box;
			border-bottom: 1px solid #eee;
			padding-bottom: 25rpx;
		}

		.message-list {
			width: 100%;
			.message-item {
				display: flex;
				justify-content: space-between;
				margin-top: 20rpx;
				image {
					width: 100rpx;
					height: 100rpx;
				}

				.right {
					display: flex;
					box-sizing: border-box;
					border-bottom: 1px solid #eee;
					padding-bottom: 30rpx;
					text {
						display: block;
						width: 80%;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						margin-left: 20rpx;
						&:nth-child(1) {
							font-size: 38rpx;
							margin-bottom: 10rpx;
						}

						&:nth-child(2) {
							font-size: 24rpx;
						}
					}
				}
				.message-time{
					font-size: 24rpx;
					line-height: 100rpx;
				}
			}
		}
	}
</style>
